package pdfsetter.core.schema;

import pdfsetter.core.schema.advanced.FillingSchemaPattern;

/**
 * SimpleDocumentSchemaPattern is pattern which corresponds to {@link SimpleDocumentSchema}. It contains {@link SinglePageSchema} and
 * {@link FillingSchemaPattern}. It represents pattern in which we set document with the same layout on every page (but of course we can choose pages in very
 * different ways).
 * 
 * @author Andrzej Dorobisz
 */
public class SimpleDocumentSchemaPattern implements DocumentSchemaPattern {
    private final SinglePageSchema pageSchema;
    private final FillingSchemaPattern fillingPattern;

    public SimpleDocumentSchemaPattern(SinglePageSchema pageSchema, FillingSchemaPattern fillingPattern) {
        this.pageSchema = pageSchema;
        this.fillingPattern = fillingPattern;
    }

    @Override
    public DocumentSchema produceDocumentSchema(int[] fileSizes) {
        return new SimpleDocumentSchema(pageSchema, fillingPattern.produceFillingSchema(fileSizes));
    }

    @Override
    public int getExpectedNumberOfFiles() {
        return fillingPattern.getExpectedNumberOfFiles();
    }
}
